package com.test;

import java.io.PrintWriter;

import com.core.mvc.Require;
import com.core.mvc.annotation.Action;
import com.core.mvc.annotation.Service;
import com.test.utils.AccessTokenUtil;

/**
 * 微信access_token获取接口
 * 
 * @author 殷田
 *
 */
@Service("/menu")
public class WeiXinMenu {
	
	@Action("create")
	public void create(Require require) {
		require.getResp().setContentType("text/html;charset=UTF-8");
		PrintWriter out = null;
		try {
			String token=AccessTokenUtil.getToken();
			String result = MenuHandler.getHandler().createMenu(token);
			out = require.getResp().getWriter();
			out.println("请求token: " + token);
			out.println("创建菜单 result: " + result);
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			if (out != null) {
				out.println("创建菜单");
				out.flush();
			}
		}
	}
}
